package typinggame;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.awt.*;
import java.math.*;
/**
 *
 * @author suhui
 */
public class runningword extends word{
        int move;
        boolean byteam;
        int row;
        int speed;
        int count = 0;
        boolean interceptedbyme = false;


    public runningword(String word, int x, int y, String direction, boolean byuser, int spd){
        super(word,x,y);
        byteam = !byuser;
        row = y/20;
        speed = spd;
        count = 10-spd;
        if(direction == "left")
            move = -1;
        else
            move=1;
    }
    public void movew(){
        int x = getx();
        int y = gety();

        if(count == 0)
        {
            x += move;
            count = 10-speed;
        }
        else
            count--;
        setx(x);
    }
    public void setintercepted()
    {
        this.interceptedbyme = true;
    }
    public int getlevel()
    {
        return Math.abs(move);
    }
}
